<template>
  <dialog-editor ref="dialog"></dialog-editor>
</template>

<script>
import DialogEditor from '@/components/DialogEditor'
import dialogMixins from '@/utils/commonDialogMixins'

export default {
  mixins: [dialogMixins],
  components: {DialogEditor},
  data: function () {
    return {
      dataFormConfig: {
        id: {
          hidden: true
        },
        deepCategoryName: {
          label: '深加工名称',
          placeholder: '请输入深加工名称'
        },
        localhost: {
          type: 'radio',
          label: '深加工生产范围',
          radioBorder: true,
          radioList: [
            {text: '深加工中心', label: 1},
            {text: '外协', label: 0}
          ],
          default:0
        },

        status: {
          label: '状态',
          type: 'switch',
          activeValue: 1,
          inactiveValue: 0,
          default: 1
        }
      }
    }
  },
  methods: {
    init(id,property,cb) {
      this.dataForm.id = id || 0
      this.$refs.dialog.initDialog({
        dataForm: this.dataForm,
        config: this.dataFormConfig,
        dataRule: this.getNeedDataRule('deepCategoryName', 'status'),
        initApi: 'deepApi/deepCategoryInfo',
        saveApi: 'deepApi/saveDeepCategory',
        updateApi: 'deepApi/updateDeepCategory',
        objectName: 'deepCategory',
        submitCallback: cb
      })
    }
  }
}
</script>
